home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 80 / XENIATGM80.iso / Goodies / Blood 2 / Source / data.z / MenuSinglePlayer.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-02  |  3.0 KB  |  121 lines

  1. // MenuSinglePlayer.cpp: implementation of the CMenuSinglePlayer class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4.  
  5. #include "MenuBase.h"
  6. #include "MainMenus.h"
  7. #include "MenuCommands.h"
  8. #include "MenuSinglePlayer.h"
  9. #include "BloodClientShell.h"
  10. #include "Splash.h"
  11. #include "ClientRes.h"
  12.  
  13. //////////////////////////////////////////////////////////////////////
  14. // Construction/Destruction
  15. //////////////////////////////////////////////////////////////////////
  16.  
  17. CMenuSinglePlayer::CMenuSinglePlayer()
  18. {
  19.     m_pSaveCtrl=DNULL;
  20. }
  21.  
  22. CMenuSinglePlayer::~CMenuSinglePlayer()
  23. {
  24.  
  25. }
  26.  
  27. // Build the menu
  28. void CMenuSinglePlayer::Build()
  29. {
  30.     // Make sure to call the base class
  31.     CMenuBase::Build();
  32.  
  33.     CreateTitle("interface\\mainmenus\\singleplayer.pcx", IDS_MENU_TITLE_SINGLEPLAYER, m_pMainMenus->GetTitlePos());        
  34.     SetOptionPos(m_pMainMenus->GetOptionsPos());
  35.     SetItemSpacing(0);
  36.  
  37. #ifdef _ADDON
  38.     AddLargeTextItemOption(IDS_MENU_SINGLEPLAYER_NIGHTMARES, MENU_CMD_START_NIGHTMARES);
  39. #endif
  40.  
  41.     AddLargeTextItemOption(IDS_MENU_SINGLEPLAYER_CALEB, MENU_CMD_START_STORY);
  42.     AddLargeTextItemOption(IDS_MENU_SINGLEPLAYER_CHOSEN, MENU_CMD_START_ACTION);
  43.  
  44. #ifndef _DEMO
  45.     AddLargeTextItemOption(IDS_MENU_SINGLEPLAYER_LOADGAME, MENU_CMD_LOAD_GAME_MENU);
  46.  
  47.     m_pSaveCtrl = AddLargeTextItemOption(IDS_MENU_SINGLEPLAYER_SAVEGAME, MENU_CMD_SAVE_GAME_MENU);
  48.     
  49.     AddLargeTextItemOption(IDS_MENU_SINGLEPLAYER_CUSTOMLEVEL, MENU_CMD_CUSTOM_LEVEL);    
  50. #endif
  51.  
  52. }
  53.  
  54. // Enable/Disable the save option
  55. void CMenuSinglePlayer::EnableSave(DBOOL bEnable)
  56. {
  57.     if ( m_pSaveCtrl )
  58.     {
  59.         m_pSaveCtrl->Enable(bEnable);
  60.     }
  61. }
  62.  
  63. DDWORD CMenuSinglePlayer::OnCommand(DDWORD dwCommand, DDWORD dwParam1, DDWORD dwParam2)
  64. {
  65.     switch ( dwCommand )
  66.     {
  67.  
  68. #ifdef _ADDON
  69.     case MENU_CMD_START_NIGHTMARES:
  70.         {
  71.             // Change the menu
  72.             m_pMainMenus->SetCurrentMenu(MENU_ID_DIFFICULTY);
  73.  
  74.             // Tell the difficulty menu about the type of game we are starting
  75.             m_pMainMenus->GetDifficultyMenu()->SetNightmaresMode(DTRUE);
  76.  
  77.             // Set the parent menu        
  78.             m_pMainMenus->GetDifficultyMenu()->SetParentMenu(this);
  79.             break;
  80.         }
  81. #endif
  82.  
  83.     case MENU_CMD_START_STORY:
  84.         {
  85.             // Change the menu
  86.             m_pMainMenus->SetCurrentMenu(MENU_ID_DIFFICULTY);
  87.  
  88.             // Tell the difficulty menu about the type of game we are starting
  89.             m_pMainMenus->GetDifficultyMenu()->SetStoryMode(DTRUE);
  90.  
  91.             // Set the parent menu        
  92.             m_pMainMenus->GetDifficultyMenu()->SetParentMenu(this);
  93.             break;
  94.         }
  95.     case MENU_CMD_START_ACTION:
  96.         {
  97. #ifdef _DEMO
  98.             Splash_SetState(m_pClientDE, "\\screens\\modes.pcx");
  99. #else
  100.             m_pMainMenus->SetCurrentMenu(MENU_ID_CHARACTERSELECT);
  101. #endif
  102.             break;
  103.         }    
  104.     case MENU_CMD_CUSTOM_LEVEL:
  105.         {
  106.             m_pMainMenus->SetCurrentMenu(MENU_ID_CUSTOM_LEVEL);
  107.             break;
  108.         }    
  109.     case MENU_CMD_LOAD_GAME_MENU:
  110.         {
  111.             m_pMainMenus->SetCurrentMenu(MENU_ID_LOAD_GAME);
  112.             break;
  113.         }
  114.     case MENU_CMD_SAVE_GAME_MENU:
  115.         {
  116.             m_pMainMenus->SetCurrentMenu(MENU_ID_SAVE_GAME);
  117.             break;
  118.         }
  119.     }
  120.     return 0;
  121. }